package pers.lx.crm.controller.market;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.lx.crm.base.common.pigeon.Result;
import pers.lx.crm.entiy.market.MarketDO;
import pers.lx.crm.entiy.market.MarketListDO;
import pers.lx.crm.service.market.MarketService;

/**
 * Created by lxl on 2017/3/8.
 */
@Controller
@RequestMapping(value = "market")
public class MarketController {

    @Autowired
    private MarketService marketService ;

    @RequestMapping(value = "/list")
    public @ResponseBody
    Result getMarketList(MarketDO marketDO){
        return marketService.getMarkets(marketDO) ;
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public @ResponseBody
    Result addTag(@RequestBody MarketDO marketDO){
        Result result = marketService.addMarket(marketDO) ;
        return result ;
    }

    @RequestMapping(value = "/remove",method = RequestMethod.POST)
    public @ResponseBody
    Result removeTags(@RequestBody MarketListDO listDO){
        Result result = marketService.removeMarkets(listDO.getMarketDOs()) ;
        return  result ;
    }


}
